//
//  ClassTwoViewController.m
//  Feel_at_home
//
//  Created by dlios on 15/9/28.
//  Copyright © 2015年 Feel_at_home. All rights reserved.
//

#import "ClassTwoViewController.h"
#import "WidthAndHeight.pch"
#import "HTTPTOOL.h"
#import "LocationCell.h"
#import "CategoryCell.h"
#import "CollectionView.h"
#import "ClassTwoDataViewController.h"

@interface ClassTwoViewController ()<UITableViewDataSource, UITableViewDelegate, thiredDelegate, ThiredTwoDelegate>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation ClassTwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"精品分类";
    [self tableViewSubViews];
}

// tableView
- (void)tableViewSubViews
{
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, VCWIDTH, VCHEIGH - 64) style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

// tableView 协议

// 区
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

// 行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

// cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0)
    {
        LocationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"resue12"];
        
        if (!cell) {
            cell = [[LocationCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"resue12"];
        }
        cell.col.CDelegate = self;
        cell.title.text = @"地点";
        cell.title.font = [UIFont boldSystemFontOfSize:17];
        
        cell.selectionStyle = NO;
        
        return cell;
    }
    else
    {
        CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:@"resue13"];
        
        if (!cell) {
            cell = [[CategoryCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"resue13"];
        }
        cell.col.delegate = self;
        
        cell.title.text = @"品类";
        cell.title.font = [UIFont boldSystemFontOfSize:17];
        
        cell.selectionStyle = NO;
        
        return cell;
    }

}

// 每行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (indexPath.section == 0){
        return 300;
    }
    else{
        return 166;
    }
}

// 页眉高
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 1;
}

//点击方法
// 协议方法

- (void)CUrl:(NSString *)URl
{
    ClassTwoDataViewController *To = [[ClassTwoDataViewController alloc]init];
    To.URL = URl;
    [self.navigationController pushViewController:To animated:YES];
}

- (void)ThiredTwoDelegate:(NSString *)url
{
    ClassTwoDataViewController *To = [[ClassTwoDataViewController alloc]init];
    To.URL = url;
    [self.navigationController pushViewController:To animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
